from django.contrib import admin
from django.db.models import JSONField
from django_json_widget.widgets import JSONEditorWidget

from apps.subscriptions.models import Subscription


@admin.register(Subscription)
class SubscriptionAdmin(admin.ModelAdmin):
    formfield_overrides = {
        JSONField: {'widget': JSONEditorWidget},
    }

    list_display = ('company_name', 'first_name', 'last_name','phone_number', 'email', 'message', 'created_at')
    search_fields = ('first_name', 'last_name', 'company_name', 'email')
    ordering = ('-created_at',)


admin.site.site_header = 'Django管理后台'  # 设置header
admin.site.site_title = '管理后台'  # 设置title
admin.site.index_title = 'Django管理后台'
